<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('团队政策信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input type="hidden" name="type" value="3">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 80px;">政策名称：</label>
                                <input type="text" name="policyName"/>
                            </li>
                            <li>
                                <label style="width: 80px;">类型：</label>
                                <select name="status">
                                    <option value="">所有</option>
                                    <option value="1">正常</option>
                                    <option value="0">关停</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label style="width: 80px;">开始日期：</label>
                                <input type="text" class="time-input"  placeholder="开始时间" name="start"/>
                                <span>-</span>
                                <input type="text" class="time-input"  placeholder="结束时间" name="end"/>
                            </li>
                            <li class="select-time">
                                <label style="width: 80px;">结束日期：</label>
                                <input type="text" class="time-input"  placeholder="开始时间" name="start1"/>
                                <span>-</span>
                                <input type="text" class="time-input"  placeholder="结束时间" name="end1"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="addPolicyZl()" shiro:hasPermission="team:policy:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
             <!--   <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="team:policy:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="team:policy:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="team:policy:export">
                    <i class="fa fa-download"></i> 导出
                </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('team:policy:edit')}]];
        var removeFlag = [[${@permission.hasPermi('team:policy:remove')}]];
        var prefix = ctx + "team/policy";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "团队政策信息",
                queryParams:queryParams,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'policyName',
                    title: '政策名称'
                },
                {
                    field: 'policyValue',
                    title: '政策内容'
                },
                {
                    field: 'policyCondition',
                    title: '开始区间金额(元)'
                },
                {
                    field: 'policyConditionEnd',
                    title: '结束区间金额(元)'
                },
                {
                    field: 'startDate',
                    title: '开始日期'
                },
                {
                    field: 'endDate',
                    title: '结束日期'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter(value,row,index){
                        if (value == '0'){
                            return "<span style='color: red'>关停</span>";
                        }
                        if (value == '1'){
                            return "<span style='color: green'>正常</span>";
                        }
                    }
                },
                {
                    field: 'createDate',
                    title: '创建时间'
                },
                {
                    field: 'createDate',
                    title: '创建时间'
                },
                {
                    field: 'addMan',
                    title: '添加人'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="editPolicyZl(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });


        /**
         * 新增增量
         */
        function addPolicyZl() {
            $.modal.open("新增增量政策", prefix + "/addPolicyZl",1200,650);
        }

        /**
         * 增量奖励
         */
        function queryParams(params) {
            var search = $.table.queryParams(params);
            search.type = "3";
            return search;
        }

        /**
         * 编辑引流政策
         * @param id
         */
        function editPolicyZl(id) {
            $.modal.open("修改增量政策", prefix + "/editPolicyCg?id="+id,1200,650);
        }


    </script>
</body>
</html>